use serde::Deserialize;
use validator::Validate;

#[derive(Debug, Deserialize, Validate)]
pub struct RoleQueryParams {
    pub role_code: Option<String>,
    pub role_name: Option<String>,
    pub bound_user: Option<String>,
    pub unbound_user: Option<String>,
}

#[derive(Debug, Deserialize, Validate)]
pub struct RoleCreateParams {
    #[validate(length(min = 1, message = "角色编码必填"))]
    pub role_code: String,

    #[validate(length(min = 1, message = "角色名称必填"))]
    pub role_name: String,

    pub role_description: Option<String>,
}

#[derive(Debug, Deserialize, Validate)]
pub struct RoleUpdateParams {
    #[validate(length(min = 1, message = "角色编码必填"))]
    pub role_code: String,

    #[validate(length(min = 1, message = "角色名称必填"))]
    pub role_name: String,

    pub role_description: Option<String>,
}

#[derive(Debug, Deserialize, Validate)]
pub struct RoleDeleteParams {
    #[validate(length(min = 1, message = "角色编码必填"))]
    pub role_code: String,
}
